﻿function mouseMove(evt)
{
  if(!draggedBox) return true;
  coords = mousePos(evt);
  
  draggedBox.style.position = "absolute";
  draggedBox.style.top = (coords.y - offset.y) + "px";
  draggedBox.style.left = (coords.x - offset.x) + "px";
  
  var imgOrg = document.getElementById('imgOrg');
  var lupaDiv = document.getElementById('lupaDiv');
  if(!imgOrg || !lupaDiv) return true;
  
  xPos = imgOrg.offsetLeft;
  yPos = imgOrg.offsetTop;
  lupaDiv.style.backgroundPosition = 
    -((coords.x - Math.round(offset.x / 2) - xPos) * magnify) + "px " + 
    -((coords.y - Math.round(offset.y / 2) - yPos) * magnify) + "px";
  return false;
}